{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python_defaultSpec_1600412137852",
   "display_name": "Python 3.7.4 64-bit ('base': conda)"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "source": [
    "# 获得前n个主成分"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = np.empty((100, 2))\n",
    "X[:,0] = np.random.uniform(0., 100., size=100)\n",
    "X[:,1] = 0.75 * X[:,0] + 3. + np.random.normal(0, 10., size=100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "def demean(X):\n",
    "    return X - np.mean(X, axis=0)\n",
    "\n",
    "X = demean(X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 377.304687 248.518125\" width=\"377.304687pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <defs>\r\n  <style type=\"text/css\">\r\n*{stroke-linecap:butt;stroke-linejoin:round;}\r\n  </style>\r\n </defs>\r\n <g id=\"figure_1\">\r\n  <g id=\"patch_1\">\r\n   <path d=\"M 0 248.518125 \r\nL 377.304687 248.518125 \r\nL 377.304687 0 \r\nL 0 0 \r\nz\r\n\" style=\"fill:none;\"/>\r\n  </g>\r\n  <g id=\"axes_1\">\r\n   <g id=\"patch_2\">\r\n    <path d=\"M 35.304688 224.64 \r\nL 370.104688 224.64 \r\nL 370.104688 7.2 \r\nL 35.304688 7.2 \r\nz\r\n\" style=\"fill:#ffffff;\"/>\r\n   </g>\r\n   <g id=\"PathCollection_1\">\r\n    <defs>\r\n     <path d=\"M 0 3 \r\nC 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\nC 2.683901 1.55874 3 0.795609 3 0 \r\nC 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\nC 1.55874 -2.683901 0.795609 -3 0 -3 \r\nC -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\nC -2.683901 -1.55874 -3 -0.795609 -3 0 \r\nC -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\nC -1.55874 2.683901 -0.795609 3 0 3 \r\nz\r\n\" id=\"ma987ca7c3c\" style=\"stroke:#1f77b4;\"/>\r\n    </defs>\r\n    <g clip-path=\"url(#p1dd405b24f)\">\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"126.862931\" xlink:href=\"#ma987ca7c3c\" y=\"173.395346\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"135.037378\" xlink:href=\"#ma987ca7c3c\" y=\"152.286608\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"68.157053\" xlink:href=\"#ma987ca7c3c\" y=\"149.358293\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"321.941793\" xlink:href=\"#ma987ca7c3c\" y=\"49.726848\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"212.473952\" xlink:href=\"#ma987ca7c3c\" y=\"100.686231\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"199.593966\" xlink:href=\"#ma987ca7c3c\" y=\"129.173055\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"100.844256\" xlink:href=\"#ma987ca7c3c\" y=\"165.21817\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"220.333945\" xlink:href=\"#ma987ca7c3c\" y=\"92.35164\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"294.505032\" xlink:href=\"#ma987ca7c3c\" y=\"59.623536\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"257.155851\" xlink:href=\"#ma987ca7c3c\" y=\"131.895388\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"309.513775\" xlink:href=\"#ma987ca7c3c\" y=\"43.162015\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"202.870974\" xlink:href=\"#ma987ca7c3c\" y=\"130.730888\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"51.977228\" xlink:href=\"#ma987ca7c3c\" y=\"194.458411\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"354.858461\" xlink:href=\"#ma987ca7c3c\" y=\"17.113609\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"295.332969\" xlink:href=\"#ma987ca7c3c\" y=\"68.138073\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"175.528091\" xlink:href=\"#ma987ca7c3c\" y=\"165.193307\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"263.519381\" xlink:href=\"#ma987ca7c3c\" y=\"70.631203\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"93.807623\" xlink:href=\"#ma987ca7c3c\" y=\"148.21985\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"245.032512\" xlink:href=\"#ma987ca7c3c\" y=\"115.536475\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"173.454215\" xlink:href=\"#ma987ca7c3c\" y=\"146.227094\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"66.402101\" xlink:href=\"#ma987ca7c3c\" y=\"143.896076\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"259.822304\" xlink:href=\"#ma987ca7c3c\" y=\"38.544993\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"274.473322\" xlink:href=\"#ma987ca7c3c\" y=\"89.290597\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"329.670725\" xlink:href=\"#ma987ca7c3c\" y=\"80.523884\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"330.234297\" xlink:href=\"#ma987ca7c3c\" y=\"57.101831\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"96.499948\" xlink:href=\"#ma987ca7c3c\" y=\"160.445157\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"318.192113\" xlink:href=\"#ma987ca7c3c\" y=\"34.580932\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"247.750913\" xlink:href=\"#ma987ca7c3c\" y=\"91.083807\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"162.675766\" xlink:href=\"#ma987ca7c3c\" y=\"171.46533\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"250.889325\" xlink:href=\"#ma987ca7c3c\" y=\"77.927197\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"271.700235\" xlink:href=\"#ma987ca7c3c\" y=\"90.351368\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"67.657326\" xlink:href=\"#ma987ca7c3c\" y=\"214.726391\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"309.22566\" xlink:href=\"#ma987ca7c3c\" y=\"47.413563\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"149.225339\" xlink:href=\"#ma987ca7c3c\" y=\"123.100335\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"236.567985\" xlink:href=\"#ma987ca7c3c\" y=\"107.483446\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"184.321328\" xlink:href=\"#ma987ca7c3c\" y=\"109.534659\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"50.550914\" xlink:href=\"#ma987ca7c3c\" y=\"193.955773\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"135.077988\" xlink:href=\"#ma987ca7c3c\" y=\"119.328415\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"266.536276\" xlink:href=\"#ma987ca7c3c\" y=\"89.15705\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"272.469264\" xlink:href=\"#ma987ca7c3c\" y=\"58.969359\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"325.171147\" xlink:href=\"#ma987ca7c3c\" y=\"55.773979\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"104.625385\" xlink:href=\"#ma987ca7c3c\" y=\"167.825112\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"192.358276\" xlink:href=\"#ma987ca7c3c\" y=\"132.386278\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"284.219275\" xlink:href=\"#ma987ca7c3c\" y=\"44.41501\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"259.73818\" xlink:href=\"#ma987ca7c3c\" y=\"107.487557\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"255.116575\" xlink:href=\"#ma987ca7c3c\" y=\"83.502798\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"103.414227\" xlink:href=\"#ma987ca7c3c\" y=\"133.260693\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"135.727961\" xlink:href=\"#ma987ca7c3c\" y=\"146.465203\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"224.180901\" xlink:href=\"#ma987ca7c3c\" y=\"115.91261\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"241.876994\" xlink:href=\"#ma987ca7c3c\" y=\"108.671722\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"71.698869\" xlink:href=\"#ma987ca7c3c\" y=\"195.299029\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"186.766507\" xlink:href=\"#ma987ca7c3c\" y=\"158.3323\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"233.668161\" xlink:href=\"#ma987ca7c3c\" y=\"116.249652\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"142.145086\" xlink:href=\"#ma987ca7c3c\" y=\"176.271853\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"155.380633\" xlink:href=\"#ma987ca7c3c\" y=\"124.265312\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"194.211913\" xlink:href=\"#ma987ca7c3c\" y=\"97.255664\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"235.864711\" xlink:href=\"#ma987ca7c3c\" y=\"86.642783\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"247.951055\" xlink:href=\"#ma987ca7c3c\" y=\"68.213413\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"94.976676\" xlink:href=\"#ma987ca7c3c\" y=\"154.129102\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"181.451173\" xlink:href=\"#ma987ca7c3c\" y=\"124.036743\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"69.506995\" xlink:href=\"#ma987ca7c3c\" y=\"174.242859\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"316.625818\" xlink:href=\"#ma987ca7c3c\" y=\"43.529423\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"140.423576\" xlink:href=\"#ma987ca7c3c\" y=\"148.678871\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"347.617351\" xlink:href=\"#ma987ca7c3c\" y=\"54.59426\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"308.342934\" xlink:href=\"#ma987ca7c3c\" y=\"52.281308\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"191.36116\" xlink:href=\"#ma987ca7c3c\" y=\"103.063357\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"243.467028\" xlink:href=\"#ma987ca7c3c\" y=\"109.506538\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"284.987435\" xlink:href=\"#ma987ca7c3c\" y=\"77.698702\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"122.55641\" xlink:href=\"#ma987ca7c3c\" y=\"166.056005\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"230.30457\" xlink:href=\"#ma987ca7c3c\" y=\"98.090251\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"102.813461\" xlink:href=\"#ma987ca7c3c\" y=\"196.933199\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"106.394357\" xlink:href=\"#ma987ca7c3c\" y=\"167.378406\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"327.197796\" xlink:href=\"#ma987ca7c3c\" y=\"42.86796\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"239.650794\" xlink:href=\"#ma987ca7c3c\" y=\"108.452245\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"230.622048\" xlink:href=\"#ma987ca7c3c\" y=\"120.539977\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"65.533911\" xlink:href=\"#ma987ca7c3c\" y=\"178.177865\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"139.042812\" xlink:href=\"#ma987ca7c3c\" y=\"167.940181\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"83.015157\" xlink:href=\"#ma987ca7c3c\" y=\"158.465697\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"89.781894\" xlink:href=\"#ma987ca7c3c\" y=\"198.475281\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"263.34025\" xlink:href=\"#ma987ca7c3c\" y=\"50.151867\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"210.444853\" xlink:href=\"#ma987ca7c3c\" y=\"137.651227\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"259.239007\" xlink:href=\"#ma987ca7c3c\" y=\"103.600261\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"195.372227\" xlink:href=\"#ma987ca7c3c\" y=\"133.900861\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"160.741956\" xlink:href=\"#ma987ca7c3c\" y=\"155.11841\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"221.743616\" xlink:href=\"#ma987ca7c3c\" y=\"122.901966\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"209.812551\" xlink:href=\"#ma987ca7c3c\" y=\"123.152536\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"146.753915\" xlink:href=\"#ma987ca7c3c\" y=\"167.053056\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"279.095114\" xlink:href=\"#ma987ca7c3c\" y=\"61.066443\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"54.688791\" xlink:href=\"#ma987ca7c3c\" y=\"179.246642\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"204.968935\" xlink:href=\"#ma987ca7c3c\" y=\"137.146662\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"286.78895\" xlink:href=\"#ma987ca7c3c\" y=\"69.507974\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"62.453543\" xlink:href=\"#ma987ca7c3c\" y=\"199.812817\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"117.932651\" xlink:href=\"#ma987ca7c3c\" y=\"138.071809\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"208.003385\" xlink:href=\"#ma987ca7c3c\" y=\"136.768998\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"341.074297\" xlink:href=\"#ma987ca7c3c\" y=\"31.302083\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"75.838957\" xlink:href=\"#ma987ca7c3c\" y=\"144.426458\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"295.28362\" xlink:href=\"#ma987ca7c3c\" y=\"48.65872\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"77.313293\" xlink:href=\"#ma987ca7c3c\" y=\"203.358859\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"349.991811\" xlink:href=\"#ma987ca7c3c\" y=\"43.630068\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"312.439486\" xlink:href=\"#ma987ca7c3c\" y=\"56.076947\"/>\r\n    </g>\r\n   </g>\r\n   <g id=\"matplotlib.axis_1\">\r\n    <g id=\"xtick_1\">\r\n     <g id=\"line2d_1\">\r\n      <defs>\r\n       <path d=\"M 0 0 \r\nL 0 3.5 \r\n\" id=\"md73f35c83c\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n      </defs>\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"77.067656\" xlink:href=\"#md73f35c83c\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_1\">\r\n      <!-- −40 -->\r\n      <defs>\r\n       <path d=\"M 10.59375 35.5 \r\nL 73.1875 35.5 \r\nL 73.1875 27.203125 \r\nL 10.59375 27.203125 \r\nz\r\n\" id=\"DejaVuSans-8722\"/>\r\n       <path d=\"M 37.796875 64.3125 \r\nL 12.890625 25.390625 \r\nL 37.796875 25.390625 \r\nz\r\nM 35.203125 72.90625 \r\nL 47.609375 72.90625 \r\nL 47.609375 25.390625 \r\nL 58.015625 25.390625 \r\nL 58.015625 17.1875 \r\nL 47.609375 17.1875 \r\nL 47.609375 0 \r\nL 37.796875 0 \r\nL 37.796875 17.1875 \r\nL 4.890625 17.1875 \r\nL 4.890625 26.703125 \r\nz\r\n\" id=\"DejaVuSans-52\"/>\r\n       <path d=\"M 31.78125 66.40625 \r\nQ 24.171875 66.40625 20.328125 58.90625 \r\nQ 16.5 51.421875 16.5 36.375 \r\nQ 16.5 21.390625 20.328125 13.890625 \r\nQ 24.171875 6.390625 31.78125 6.390625 \r\nQ 39.453125 6.390625 43.28125 13.890625 \r\nQ 47.125 21.390625 47.125 36.375 \r\nQ 47.125 51.421875 43.28125 58.90625 \r\nQ 39.453125 66.40625 31.78125 66.40625 \r\nz\r\nM 31.78125 74.21875 \r\nQ 44.046875 74.21875 50.515625 64.515625 \r\nQ 56.984375 54.828125 56.984375 36.375 \r\nQ 56.984375 17.96875 50.515625 8.265625 \r\nQ 44.046875 -1.421875 31.78125 -1.421875 \r\nQ 19.53125 -1.421875 13.0625 8.265625 \r\nQ 6.59375 17.96875 6.59375 36.375 \r\nQ 6.59375 54.828125 13.0625 64.515625 \r\nQ 19.53125 74.21875 31.78125 74.21875 \r\nz\r\n\" id=\"DejaVuSans-48\"/>\r\n      </defs>\r\n      <g transform=\"translate(66.515313 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-52\"/>\r\n       <use x=\"147.412109\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_2\">\r\n     <g id=\"line2d_2\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"139.663103\" xlink:href=\"#md73f35c83c\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_2\">\r\n      <!-- −20 -->\r\n      <defs>\r\n       <path d=\"M 19.1875 8.296875 \r\nL 53.609375 8.296875 \r\nL 53.609375 0 \r\nL 7.328125 0 \r\nL 7.328125 8.296875 \r\nQ 12.9375 14.109375 22.625 23.890625 \r\nQ 32.328125 33.6875 34.8125 36.53125 \r\nQ 39.546875 41.84375 41.421875 45.53125 \r\nQ 43.3125 49.21875 43.3125 52.78125 \r\nQ 43.3125 58.59375 39.234375 62.25 \r\nQ 35.15625 65.921875 28.609375 65.921875 \r\nQ 23.96875 65.921875 18.8125 64.3125 \r\nQ 13.671875 62.703125 7.8125 59.421875 \r\nL 7.8125 69.390625 \r\nQ 13.765625 71.78125 18.9375 73 \r\nQ 24.125 74.21875 28.421875 74.21875 \r\nQ 39.75 74.21875 46.484375 68.546875 \r\nQ 53.21875 62.890625 53.21875 53.421875 \r\nQ 53.21875 48.921875 51.53125 44.890625 \r\nQ 49.859375 40.875 45.40625 35.40625 \r\nQ 44.1875 33.984375 37.640625 27.21875 \r\nQ 31.109375 20.453125 19.1875 8.296875 \r\nz\r\n\" id=\"DejaVuSans-50\"/>\r\n      </defs>\r\n      <g transform=\"translate(129.110759 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-50\"/>\r\n       <use x=\"147.412109\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_3\">\r\n     <g id=\"line2d_3\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"202.258549\" xlink:href=\"#md73f35c83c\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_3\">\r\n      <!-- 0 -->\r\n      <g transform=\"translate(199.077299 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_4\">\r\n     <g id=\"line2d_4\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"264.853996\" xlink:href=\"#md73f35c83c\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_4\">\r\n      <!-- 20 -->\r\n      <g transform=\"translate(258.491496 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-50\"/>\r\n       <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_5\">\r\n     <g id=\"line2d_5\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"327.449442\" xlink:href=\"#md73f35c83c\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_5\">\r\n      <!-- 40 -->\r\n      <g transform=\"translate(321.086942 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-52\"/>\r\n       <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n   </g>\r\n   <g id=\"matplotlib.axis_2\">\r\n    <g id=\"ytick_1\">\r\n     <g id=\"line2d_6\">\r\n      <defs>\r\n       <path d=\"M 0 0 \r\nL -3.5 0 \r\n\" id=\"m5fa3824220\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n      </defs>\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m5fa3824220\" y=\"202.977348\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_6\">\r\n      <!-- −40 -->\r\n      <g transform=\"translate(7.2 206.776567)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-52\"/>\r\n       <use x=\"147.412109\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_2\">\r\n     <g id=\"line2d_7\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m5fa3824220\" y=\"159.528574\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_7\">\r\n      <!-- −20 -->\r\n      <g transform=\"translate(7.2 163.327793)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-50\"/>\r\n       <use x=\"147.412109\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_3\">\r\n     <g id=\"line2d_8\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m5fa3824220\" y=\"116.079801\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_8\">\r\n      <!-- 0 -->\r\n      <g transform=\"translate(21.942188 119.879019)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_4\">\r\n     <g id=\"line2d_9\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m5fa3824220\" y=\"72.631027\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_9\">\r\n      <!-- 20 -->\r\n      <g transform=\"translate(15.579688 76.430246)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-50\"/>\r\n       <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_5\">\r\n     <g id=\"line2d_10\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m5fa3824220\" y=\"29.182253\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_10\">\r\n      <!-- 40 -->\r\n      <g transform=\"translate(15.579688 32.981472)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-52\"/>\r\n       <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n   </g>\r\n   <g id=\"patch_3\">\r\n    <path d=\"M 35.304688 224.64 \r\nL 35.304688 7.2 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n   <g id=\"patch_4\">\r\n    <path d=\"M 370.104688 224.64 \r\nL 370.104688 7.2 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n   <g id=\"patch_5\">\r\n    <path d=\"M 35.304688 224.64 \r\nL 370.104687 224.64 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n   <g id=\"patch_6\">\r\n    <path d=\"M 35.304688 7.2 \r\nL 370.104687 7.2 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n  </g>\r\n </g>\r\n <defs>\r\n  <clipPath id=\"p1dd405b24f\">\r\n   <rect height=\"217.44\" width=\"334.8\" x=\"35.304688\" y=\"7.2\"/>\r\n  </clipPath>\r\n </defs>\r\n</svg>\r\n",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD4CAYAAAAJmJb0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAaBUlEQVR4nO3df4xddZnH8c/DMMggroNSFKbU9g+CgiiwDZL0j1UUi8ACcXXFNUrUpNkEE2Sx0kqyixs31jQrrnF1Q9QEEzbAApZGcAtS3GTJwtpaKlux0kiETlFq0nHNtpFpefaPe6bc3jn33vP7x/e8X0nD3B9z7zkzzHO+9/k+3+dr7i4AQJiOq/sAAADlIcgDQMAI8gAQMII8AASMIA8AATu+7gPod+qpp/ry5cvrPgwAaJXt27f/zt2XxD3WqCC/fPlybdu2re7DAIBWMbNfD3uMdA0ABIwgDwABI8gDQMAI8gAQMII8AASsUdU1ANA1m3bMauOW3do3d0hnTE9p7eqzdc0FM4W9PkEeAGqyaces1t//tA7NH5Ekzc4d0vr7n5akwgI96RoAqMnGLbuPBvgFh+aPaOOW3YW9B0EeAGqyb+5QqvuzIMgDQE3OmJ5KdX8WBHkAqMna1WdranLimPumJie0dvXZhb0HE68AUJOFyVWqawAgUNdcMFNoUB9EugYAAkaQB4CAEeQBIGAEeQAIWGFB3swmzGyHmf0gur3CzJ40s2fN7G4zO6Go9wIA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z50gn4KZXSVp1t13Djw0I+mFvtt7o/tC9ClJP4y+7sJ5d+EcFzGz5ZIukPSkpDe5+4tS70Ig6bT6jqxUX1NvAPdKdPuNkub6Bjit/N2zM9QAM/uRpDfHPHSLpC9Ien/ct8Xc16ra1FHn7e4PRM+5Rb2P9HcufFvM81t13gl04RyPYWYnS7pP0mfd/X97A9qwmdmVkl5y9+1m9u6Fu2Oe2rrfPUF+gLu/L+5+MztP0gpJO6P/6ZdK+qmZXaTeFf7MvqcvlbSv5EMt1LDzXmBm10m6UtJ7/dXFFa0/7wS6cI5HmdmkegH+Tne/P7r7t2Z2uru/GKUhX6rvCEuzStJVZna5pBMl/Yl6I/tpMzs+Gs238ndPuiYhd3/a3U9z9+Xuvly9P/4L3f03kjZL+kRUZXOxpN8vfLwNgZldJulmSVe5+8G+hzZLutbMXmNmK9SbeP7vOo6xRD+RdFZUZXGCehPNm2s+plJEOejvSHrG3b/a99BmSddFX18n6YGqj61s7r7e3ZdGf9vXStrq7h+T9JikD0VPa+W5M5IvxkOSLldv4vGgpE/WeziF+4ak10h6JPoU84S7/7W77zKzeyT9XL00zvXufqTG4yycux82s89I2iJpQtJ33X1XzYdVllWSPi7paTN7KrrvC5I2SLrHzD6tXlXZh2s6vjrcLOkuM/uSpB3qXQRbhbYGABAw0jUAEDCCPAAEjCAPAAEjyANAwAjyABAwgjwABIwgDwAB+3817AQBSdaAXQAAAABJRU5ErkJggg==\n"
     },
     "metadata": {
      "needs_background": "light"
     }
    }
   ],
   "source": [
    "plt.scatter(X[:,0], X[:,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "def f(w, X):\n",
    "    return np.sum((X.dot(w)**2)) / len(X)\n",
    "\n",
    "def df(w, X):\n",
    "    return X.T.dot(X.dot(w))* 2. / len(X)\n",
    "\n",
    "def direction(w):\n",
    "    return w / np.linalg.norm(w)\n",
    "\n",
    "def first_component(X, initial_w, eta, n_iters=1e4, epsilon=1e-8):\n",
    "\n",
    "    w = direction(initial_w)\n",
    "    cur_iter = 0\n",
    "\n",
    "    while cur_iter < n_iters:\n",
    "        gradient = df(w, X)\n",
    "        last_w = w\n",
    "        w = w + eta * gradient\n",
    "        w = direction(w) # 每次求一个单位方向\n",
    "        if (abs(f(w, X) - f(last_w, X)) < epsilon):\n",
    "            break\n",
    "\n",
    "        cur_iter += 1\n",
    "    return w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "array([0.78152554, 0.62387324])"
     },
     "metadata": {},
     "execution_count": 7
    }
   ],
   "source": [
    "initial_w = np.random.random(X.shape[1])\n",
    "eta = 0.01\n",
    "w = first_component(X, initial_w ,eta)\n",
    "w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "X2 = X - X.dot(w).reshape(-1, 1) * w"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "output_type": "display_data",
     "data": {
      "text/plain": "<Figure size 432x288 with 1 Axes>",
      "image/svg+xml": "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"no\"?>\r\n<!DOCTYPE svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\"\r\n  \"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd\">\r\n<!-- Created with matplotlib (https://matplotlib.org/) -->\r\n<svg height=\"248.518125pt\" version=\"1.1\" viewBox=\"0 0 377.304687 248.518125\" width=\"377.304687pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\r\n <defs>\r\n  <style type=\"text/css\">\r\n*{stroke-linecap:butt;stroke-linejoin:round;}\r\n  </style>\r\n </defs>\r\n <g id=\"figure_1\">\r\n  <g id=\"patch_1\">\r\n   <path d=\"M 0 248.518125 \r\nL 377.304687 248.518125 \r\nL 377.304687 0 \r\nL 0 0 \r\nz\r\n\" style=\"fill:none;\"/>\r\n  </g>\r\n  <g id=\"axes_1\">\r\n   <g id=\"patch_2\">\r\n    <path d=\"M 35.304688 224.64 \r\nL 370.104688 224.64 \r\nL 370.104688 7.2 \r\nL 35.304688 7.2 \r\nz\r\n\" style=\"fill:#ffffff;\"/>\r\n   </g>\r\n   <g id=\"PathCollection_1\">\r\n    <defs>\r\n     <path d=\"M 0 3 \r\nC 0.795609 3 1.55874 2.683901 2.12132 2.12132 \r\nC 2.683901 1.55874 3 0.795609 3 0 \r\nC 3 -0.795609 2.683901 -1.55874 2.12132 -2.12132 \r\nC 1.55874 -2.683901 0.795609 -3 0 -3 \r\nC -0.795609 -3 -1.55874 -2.683901 -2.12132 -2.12132 \r\nC -2.683901 -1.55874 -3 -0.795609 -3 0 \r\nC -3 0.795609 -2.683901 1.55874 -2.12132 2.12132 \r\nC -1.55874 2.683901 -0.795609 3 0 3 \r\nz\r\n\" id=\"m5e31a8469a\" style=\"stroke:#1f77b4;\"/>\r\n    </defs>\r\n    <g clip-path=\"url(#p5fa53713f0)\">\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"255.130563\" xlink:href=\"#m5e31a8469a\" y=\"149.961991\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"201.319972\" xlink:href=\"#m5e31a8469a\" y=\"115.020855\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"71.53705\" xlink:href=\"#m5e31a8469a\" y=\"30.748173\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"204.578389\" xlink:href=\"#m5e31a8469a\" y=\"117.136661\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"173.106189\" xlink:href=\"#m5e31a8469a\" y=\"96.700639\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"242.400973\" xlink:href=\"#m5e31a8469a\" y=\"141.696214\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"181.797889\" xlink:href=\"#m5e31a8469a\" y=\"102.34447\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"160.190533\" xlink:href=\"#m5e31a8469a\" y=\"88.314042\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"187.356902\" xlink:href=\"#m5e31a8469a\" y=\"105.954135\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"354.756923\" xlink:href=\"#m5e31a8469a\" y=\"214.652941\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"160.920471\" xlink:href=\"#m5e31a8469a\" y=\"88.788017\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"253.350584\" xlink:href=\"#m5e31a8469a\" y=\"148.806188\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"188.818344\" xlink:href=\"#m5e31a8469a\" y=\"106.903102\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"157.924975\" xlink:href=\"#m5e31a8469a\" y=\"86.842935\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"216.481113\" xlink:href=\"#m5e31a8469a\" y=\"124.865524\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"316.029776\" xlink:href=\"#m5e31a8469a\" y=\"189.506023\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"167.358893\" xlink:href=\"#m5e31a8469a\" y=\"92.968715\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"113.972446\" xlink:href=\"#m5e31a8469a\" y=\"58.30299\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"279.85876\" xlink:href=\"#m5e31a8469a\" y=\"166.018892\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"250.742335\" xlink:href=\"#m5e31a8469a\" y=\"147.112558\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"50.652452\" xlink:href=\"#m5e31a8469a\" y=\"17.187059\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"56.569296\" xlink:href=\"#m5e31a8469a\" y=\"21.029077\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"247.620556\" xlink:href=\"#m5e31a8469a\" y=\"145.085476\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"318.434721\" xlink:href=\"#m5e31a8469a\" y=\"191.06764\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"243.428394\" xlink:href=\"#m5e31a8469a\" y=\"142.363355\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"158.493473\" xlink:href=\"#m5e31a8469a\" y=\"87.212081\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"148.67651\" xlink:href=\"#m5e31a8469a\" y=\"80.837577\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"205.382691\" xlink:href=\"#m5e31a8469a\" y=\"117.658923\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"313.272765\" xlink:href=\"#m5e31a8469a\" y=\"187.715797\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"168.325068\" xlink:href=\"#m5e31a8469a\" y=\"93.596086\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"246.076287\" xlink:href=\"#m5e31a8469a\" y=\"144.082727\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"282.800513\" xlink:href=\"#m5e31a8469a\" y=\"167.929077\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"174.201373\" xlink:href=\"#m5e31a8469a\" y=\"97.411781\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"132.107301\" xlink:href=\"#m5e31a8469a\" y=\"70.078599\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"238.49868\" xlink:href=\"#m5e31a8469a\" y=\"139.162316\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"151.194999\" xlink:href=\"#m5e31a8469a\" y=\"82.472922\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"184.621849\" xlink:href=\"#m5e31a8469a\" y=\"104.178168\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"94.422138\" xlink:href=\"#m5e31a8469a\" y=\"45.608278\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"232.912999\" xlink:href=\"#m5e31a8469a\" y=\"135.535335\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"145.604199\" xlink:href=\"#m5e31a8469a\" y=\"78.842616\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"230.013001\" xlink:href=\"#m5e31a8469a\" y=\"133.652262\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"197.059161\" xlink:href=\"#m5e31a8469a\" y=\"112.254158\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"239.817205\" xlink:href=\"#m5e31a8469a\" y=\"140.018482\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"119.497235\" xlink:href=\"#m5e31a8469a\" y=\"61.890432\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"280.181667\" xlink:href=\"#m5e31a8469a\" y=\"166.228567\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"194.023886\" xlink:href=\"#m5e31a8469a\" y=\"110.283246\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"82.696876\" xlink:href=\"#m5e31a8469a\" y=\"37.994646\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"183.667665\" xlink:href=\"#m5e31a8469a\" y=\"103.558582\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"243.579699\" xlink:href=\"#m5e31a8469a\" y=\"142.461603\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"251.903217\" xlink:href=\"#m5e31a8469a\" y=\"147.86636\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"227.014406\" xlink:href=\"#m5e31a8469a\" y=\"131.705168\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"313.972671\" xlink:href=\"#m5e31a8469a\" y=\"188.170271\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"261.735657\" xlink:href=\"#m5e31a8469a\" y=\"154.250915\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"291.950375\" xlink:href=\"#m5e31a8469a\" y=\"173.870408\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"146.958188\" xlink:href=\"#m5e31a8469a\" y=\"79.721809\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"129.129022\" xlink:href=\"#m5e31a8469a\" y=\"68.144696\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"169.592338\" xlink:href=\"#m5e31a8469a\" y=\"94.41897\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"131.513263\" xlink:href=\"#m5e31a8469a\" y=\"69.692868\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"135.254272\" xlink:href=\"#m5e31a8469a\" y=\"72.122039\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"193.102003\" xlink:href=\"#m5e31a8469a\" y=\"109.684635\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"154.731478\" xlink:href=\"#m5e31a8469a\" y=\"84.769283\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"174.903361\" xlink:href=\"#m5e31a8469a\" y=\"97.867607\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"199.297132\" xlink:href=\"#m5e31a8469a\" y=\"113.707352\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"266.551647\" xlink:href=\"#m5e31a8469a\" y=\"157.378109\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"188.412877\" xlink:href=\"#m5e31a8469a\" y=\"106.639818\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"142.851941\" xlink:href=\"#m5e31a8469a\" y=\"77.055477\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"257.472282\" xlink:href=\"#m5e31a8469a\" y=\"151.482553\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"228.906028\" xlink:href=\"#m5e31a8469a\" y=\"132.933465\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"223.56469\" xlink:href=\"#m5e31a8469a\" y=\"129.465144\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"196.747403\" xlink:href=\"#m5e31a8469a\" y=\"112.051722\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"288.275328\" xlink:href=\"#m5e31a8469a\" y=\"171.48407\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"198.790655\" xlink:href=\"#m5e31a8469a\" y=\"113.378479\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"191.769295\" xlink:href=\"#m5e31a8469a\" y=\"108.819259\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"247.187237\" xlink:href=\"#m5e31a8469a\" y=\"144.804106\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"270.182389\" xlink:href=\"#m5e31a8469a\" y=\"159.735679\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"160.357888\" xlink:href=\"#m5e31a8469a\" y=\"88.422712\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"259.329477\" xlink:href=\"#m5e31a8469a\" y=\"152.688496\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"127.817574\" xlink:href=\"#m5e31a8469a\" y=\"67.293126\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"269.844215\" xlink:href=\"#m5e31a8469a\" y=\"159.516091\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"100.567918\" xlink:href=\"#m5e31a8469a\" y=\"49.598952\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"289.432587\" xlink:href=\"#m5e31a8469a\" y=\"172.235519\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"266.667131\" xlink:href=\"#m5e31a8469a\" y=\"157.453097\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"250.15335\" xlink:href=\"#m5e31a8469a\" y=\"146.730109\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"256.738536\" xlink:href=\"#m5e31a8469a\" y=\"151.006105\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"261.881472\" xlink:href=\"#m5e31a8469a\" y=\"154.345597\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"241.237722\" xlink:href=\"#m5e31a8469a\" y=\"140.940874\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"270.317948\" xlink:href=\"#m5e31a8469a\" y=\"159.823702\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"164.32664\" xlink:href=\"#m5e31a8469a\" y=\"90.999765\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"144.322733\" xlink:href=\"#m5e31a8469a\" y=\"78.010514\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"277.946968\" xlink:href=\"#m5e31a8469a\" y=\"164.777497\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"205.561639\" xlink:href=\"#m5e31a8469a\" y=\"117.775121\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"225.03766\" xlink:href=\"#m5e31a8469a\" y=\"130.421596\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"124.422252\" xlink:href=\"#m5e31a8469a\" y=\"65.088422\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"282.178405\" xlink:href=\"#m5e31a8469a\" y=\"167.52512\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"179.186185\" xlink:href=\"#m5e31a8469a\" y=\"100.648598\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"69.345279\" xlink:href=\"#m5e31a8469a\" y=\"29.324979\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"153.169136\" xlink:href=\"#m5e31a8469a\" y=\"83.754799\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"263.27089\" xlink:href=\"#m5e31a8469a\" y=\"155.247796\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"235.235946\" xlink:href=\"#m5e31a8469a\" y=\"137.043707\"/>\r\n     <use style=\"fill:#1f77b4;stroke:#1f77b4;\" x=\"208.09951\" xlink:href=\"#m5e31a8469a\" y=\"119.423051\"/>\r\n    </g>\r\n   </g>\r\n   <g id=\"matplotlib.axis_1\">\r\n    <g id=\"xtick_1\">\r\n     <g id=\"line2d_1\">\r\n      <defs>\r\n       <path d=\"M 0 0 \r\nL 0 3.5 \r\n\" id=\"m2163c77b3b\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n      </defs>\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"60.082914\" xlink:href=\"#m2163c77b3b\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_1\">\r\n      <!-- −10 -->\r\n      <defs>\r\n       <path d=\"M 10.59375 35.5 \r\nL 73.1875 35.5 \r\nL 73.1875 27.203125 \r\nL 10.59375 27.203125 \r\nz\r\n\" id=\"DejaVuSans-8722\"/>\r\n       <path d=\"M 12.40625 8.296875 \r\nL 28.515625 8.296875 \r\nL 28.515625 63.921875 \r\nL 10.984375 60.40625 \r\nL 10.984375 69.390625 \r\nL 28.421875 72.90625 \r\nL 38.28125 72.90625 \r\nL 38.28125 8.296875 \r\nL 54.390625 8.296875 \r\nL 54.390625 0 \r\nL 12.40625 0 \r\nz\r\n\" id=\"DejaVuSans-49\"/>\r\n       <path d=\"M 31.78125 66.40625 \r\nQ 24.171875 66.40625 20.328125 58.90625 \r\nQ 16.5 51.421875 16.5 36.375 \r\nQ 16.5 21.390625 20.328125 13.890625 \r\nQ 24.171875 6.390625 31.78125 6.390625 \r\nQ 39.453125 6.390625 43.28125 13.890625 \r\nQ 47.125 21.390625 47.125 36.375 \r\nQ 47.125 51.421875 43.28125 58.90625 \r\nQ 39.453125 66.40625 31.78125 66.40625 \r\nz\r\nM 31.78125 74.21875 \r\nQ 44.046875 74.21875 50.515625 64.515625 \r\nQ 56.984375 54.828125 56.984375 36.375 \r\nQ 56.984375 17.96875 50.515625 8.265625 \r\nQ 44.046875 -1.421875 31.78125 -1.421875 \r\nQ 19.53125 -1.421875 13.0625 8.265625 \r\nQ 6.59375 17.96875 6.59375 36.375 \r\nQ 6.59375 54.828125 13.0625 64.515625 \r\nQ 19.53125 74.21875 31.78125 74.21875 \r\nz\r\n\" id=\"DejaVuSans-48\"/>\r\n      </defs>\r\n      <g transform=\"translate(49.53057 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-49\"/>\r\n       <use x=\"147.412109\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_2\">\r\n     <g id=\"line2d_2\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"132.389877\" xlink:href=\"#m2163c77b3b\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_2\">\r\n      <!-- −5 -->\r\n      <defs>\r\n       <path d=\"M 10.796875 72.90625 \r\nL 49.515625 72.90625 \r\nL 49.515625 64.59375 \r\nL 19.828125 64.59375 \r\nL 19.828125 46.734375 \r\nQ 21.96875 47.46875 24.109375 47.828125 \r\nQ 26.265625 48.1875 28.421875 48.1875 \r\nQ 40.625 48.1875 47.75 41.5 \r\nQ 54.890625 34.8125 54.890625 23.390625 \r\nQ 54.890625 11.625 47.5625 5.09375 \r\nQ 40.234375 -1.421875 26.90625 -1.421875 \r\nQ 22.3125 -1.421875 17.546875 -0.640625 \r\nQ 12.796875 0.140625 7.71875 1.703125 \r\nL 7.71875 11.625 \r\nQ 12.109375 9.234375 16.796875 8.0625 \r\nQ 21.484375 6.890625 26.703125 6.890625 \r\nQ 35.15625 6.890625 40.078125 11.328125 \r\nQ 45.015625 15.765625 45.015625 23.390625 \r\nQ 45.015625 31 40.078125 35.4375 \r\nQ 35.15625 39.890625 26.703125 39.890625 \r\nQ 22.75 39.890625 18.8125 39.015625 \r\nQ 14.890625 38.140625 10.796875 36.28125 \r\nz\r\n\" id=\"DejaVuSans-53\"/>\r\n      </defs>\r\n      <g transform=\"translate(125.018783 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-53\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_3\">\r\n     <g id=\"line2d_3\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"204.69684\" xlink:href=\"#m2163c77b3b\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_3\">\r\n      <!-- 0 -->\r\n      <g transform=\"translate(201.51559 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_4\">\r\n     <g id=\"line2d_4\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"277.003802\" xlink:href=\"#m2163c77b3b\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_4\">\r\n      <!-- 5 -->\r\n      <g transform=\"translate(273.822552 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-53\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"xtick_5\">\r\n     <g id=\"line2d_5\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"349.310765\" xlink:href=\"#m2163c77b3b\" y=\"224.64\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_5\">\r\n      <!-- 10 -->\r\n      <g transform=\"translate(342.948265 239.238437)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-49\"/>\r\n       <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n   </g>\r\n   <g id=\"matplotlib.axis_2\">\r\n    <g id=\"ytick_1\">\r\n     <g id=\"line2d_6\">\r\n      <defs>\r\n       <path d=\"M 0 0 \r\nL -3.5 0 \r\n\" id=\"m13e99b99eb\" style=\"stroke:#000000;stroke-width:0.8;\"/>\r\n      </defs>\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m13e99b99eb\" y=\"192.17409\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_6\">\r\n      <!-- −10 -->\r\n      <g transform=\"translate(7.2 195.973309)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-49\"/>\r\n       <use x=\"147.412109\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_2\">\r\n     <g id=\"line2d_7\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m13e99b99eb\" y=\"154.693833\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_7\">\r\n      <!-- −5 -->\r\n      <g transform=\"translate(13.5625 158.493052)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-8722\"/>\r\n       <use x=\"83.789062\" xlink:href=\"#DejaVuSans-53\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_3\">\r\n     <g id=\"line2d_8\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m13e99b99eb\" y=\"117.213575\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_8\">\r\n      <!-- 0 -->\r\n      <g transform=\"translate(21.942188 121.012794)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_4\">\r\n     <g id=\"line2d_9\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m13e99b99eb\" y=\"79.733318\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_9\">\r\n      <!-- 5 -->\r\n      <g transform=\"translate(21.942188 83.532537)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-53\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n    <g id=\"ytick_5\">\r\n     <g id=\"line2d_10\">\r\n      <g>\r\n       <use style=\"stroke:#000000;stroke-width:0.8;\" x=\"35.304688\" xlink:href=\"#m13e99b99eb\" y=\"42.25306\"/>\r\n      </g>\r\n     </g>\r\n     <g id=\"text_10\">\r\n      <!-- 10 -->\r\n      <g transform=\"translate(15.579688 46.052279)scale(0.1 -0.1)\">\r\n       <use xlink:href=\"#DejaVuSans-49\"/>\r\n       <use x=\"63.623047\" xlink:href=\"#DejaVuSans-48\"/>\r\n      </g>\r\n     </g>\r\n    </g>\r\n   </g>\r\n   <g id=\"patch_3\">\r\n    <path d=\"M 35.304688 224.64 \r\nL 35.304688 7.2 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n   <g id=\"patch_4\">\r\n    <path d=\"M 370.104688 224.64 \r\nL 370.104688 7.2 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n   <g id=\"patch_5\">\r\n    <path d=\"M 35.304688 224.64 \r\nL 370.104688 224.64 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n   <g id=\"patch_6\">\r\n    <path d=\"M 35.304688 7.2 \r\nL 370.104688 7.2 \r\n\" style=\"fill:none;stroke:#000000;stroke-linecap:square;stroke-linejoin:miter;stroke-width:0.8;\"/>\r\n   </g>\r\n  </g>\r\n </g>\r\n <defs>\r\n  <clipPath id=\"p5fa53713f0\">\r\n   <rect height=\"217.44\" width=\"334.8\" x=\"35.304688\" y=\"7.2\"/>\r\n  </clipPath>\r\n </defs>\r\n</svg>\r\n",
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXkAAAD4CAYAAAAJmJb0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxv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mz5rZb6t/rw1zDJkJeUmvSNos6fn6g2Z2paRbJF0l6QZJ3zGznrPfnjkPu3t/9c+Pox5M1KrfiW9L+qSkKyXdWv3u4Gwfq35v6JWXvquFXKm3XdJz7n6FpOeqj0OTmZB391+7e6PdcW+U9KS7/9Xdfy/pVUnXdHd0SIBrJL3q7q+5+9uSntTCdwdoyt2fl/TWksM3Snq8+vPjkophjiEzId9CQdIf6x4fqx7LurvM7JfV/7sZ6v+dTAi+J8G4pGfM7CUz2xr1YGLqA+7+hiRV/744zJOlamcoM/uZpA82eOor7v6DZm9rcCz1faWtPitJ/ynpG1r4HL4h6SFJn+/e6GIpk9+TFdjk7sfN7GJJz5rZb6pXs4hIqkLe3T++grcdk3Rp3eMPSTremRHFV9DPyswelfSjkIeTBJn8nrTL3Y9X/37TzJ7WQpmLkF/sT2Z2ibu/YWaXSHozzJNRrpEOSbrFzP7GzDZIukLSzyMeU6SqX7yam7QwaZ11v5B0hZltMLNztTBZfyjiMcWKmZ1vZu+r/SzpevHdaeSQpDuqP98hqVmVoSNSdSXfipndJOk/JF0k6bCZTbn7kLsfNbMDkn4l6R1JX3L3+SjHGgPfNLN+LZQjXpf0xWiHEz13f8fM7pI0JqlH0mPufjTiYcXNByQ9bWbSQrY84e4/jXZI0TKz70n6R0kXmtkxSfdJ2i3pgJl9QdKspJtDHQPLGgBAelGuAYAUI+QBIMUIeQBIMUIeAFKMkAeAFCPkASDFCHkASLH/ByWL/n0upa2tAAAAAElFTkSuQmCC\n"
     },
     "metadata": {
      "needs_background": "light"
     }
    }
   ],
   "source": [
    "plt.scatter(X2[:,0], X2[:,1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "array([ 0.62387916, -0.78152082])"
     },
     "metadata": {},
     "execution_count": 14
    }
   ],
   "source": [
    "w2 = first_component(X2, initial_w, eta)\n",
    "w2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "7.574418852462905e-06"
     },
     "metadata": {},
     "execution_count": 15
    }
   ],
   "source": [
    "w.dot(w2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def first_n_component(n, X, eta=0.01, n_iters=1e4, epsilon=1e-8):\n",
    "\n",
    "    X_pca = X.copy()\n",
    "    X_pca = demean(X_pca)\n",
    "    res = []\n",
    "    for i in range(n):\n",
    "        initial_w = np.random.random(X_pca.shape[1])\n",
    "        w = first_component(X_pca, initial_w, eta)\n",
    "        res.append(w)\n",
    "\n",
    "        X_pca = X_pca - X_pca.dot(w).reshape(-1, 1) * w\n",
    "\n",
    "    return res"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": "[array([0.78152535, 0.62387349]), array([ 0.62387844, -0.7815214 ])]"
     },
     "metadata": {},
     "execution_count": 20
    }
   ],
   "source": [
    "first_n_component(2, X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}